import React from 'react';
import BoardRow from './BoardRow'
import PropTypes from 'prop-types';

export default class Board extends React.Component {
    static propTypes = {
        onColClick:PropTypes.func
    };


    handleColClick(row, col){
        this.props.onColClick(row, col);
    }

    render() {
        const {checkerboard} = this.props;

        return (
            <div>
                {
                    checkerboard.map((item, index) => {
                        return <BoardRow onColClick={this.handleColClick.bind(this)} cols={item} row={index}
                                         key={index} />
                    })
                }
            </div>
        );
    }
}
